From 96b3419dff5afd13db0f5adb3951f00cfd29a951 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 21 Dec 2006 12:34:41 +0000 Subject: [PATCH] Add a function for converting a GdkColor to a string (#373856). 2006-12-21 Matthew Barnes * docs/reference/gdk/gdk-sections.txt: * gdk/gdkcolor.[ch] (gdk_color_to_string): Add a function for converting a GdkColor to a string (#373856). * configure.in: Bump pango requirement to 1.15.2. --- ChangeLog | 8 ++++++++ configure.in | 2 +- docs/reference/gdk/gdk-sections.txt | 1 + gdk/gdkcolor.c | 27 +++++++++++++++++++++++++++ gdk/gdkcolor.h | 15 ++++++++------- 5 files changed, 45 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index bd0843fe85..7375d329f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-12-21 Matthew Barnes + + * docs/reference/gdk/gdk-sections.txt: + * gdk/gdkcolor.[ch] (gdk_color_to_string): Add a function for + converting a GdkColor to a string (#373856). + + * configure.in: Bump pango requirement to 1.15.2. + 2006-12-20 Matthias Clasen * gdk/keynames.txt: Mark arrow keys as translatable. (#369506, diff --git a/configure.in b/configure.in index 2194f2e6b6..2e85607193 100644 --- a/configure.in +++ b/configure.in @@ -32,7 +32,7 @@ m4_define([gtk_binary_version], [2.10.0]) # required versions of other packages m4_define([glib_required_version], [2.12.0]) -m4_define([pango_required_version], [1.12.0]) +m4_define([pango_required_version], [1.15.2]) m4_define([atk_required_version], [1.9.0]) m4_define([cairo_required_version], [1.2.0]) diff --git a/docs/reference/gdk/gdk-sections.txt b/docs/reference/gdk/gdk-sections.txt index b705f99917..dc89f088b6 100644 --- a/docs/reference/gdk/gdk-sections.txt +++ b/docs/reference/gdk/gdk-sections.txt @@ -385,6 +385,7 @@ gdk_color_alloc gdk_color_change gdk_color_equal gdk_color_hash +gdk_color_to_string GDK_COLORMAP diff --git a/gdk/gdkcolor.c b/gdk/gdkcolor.c index 83da2cddef..e533ffcc11 100644 --- a/gdk/gdkcolor.c +++ b/gdk/gdkcolor.c @@ -348,6 +348,33 @@ gdk_color_parse (const gchar *spec, return FALSE; } +/** + * gdk_color_to_string: + * @color: a #GdkColor + * + * Returns a textual specification of @color in the hexadecimal form + * #rrrrggggbbbb, where r, + * g and b are hex digits + * representing the red, green and blue components respectively. + * + * Return value: a newly-allocated text string + * + * Since: 2.12 + **/ +gchar * +gdk_color_to_string (const GdkColor *color) +{ + PangoColor pango_color; + + g_return_val_if_fail (color != NULL, NULL); + + pango_color.red = color->red; + pango_color.green = color->green; + pango_color.blue = color->blue; + + return pango_color_to_string (&pango_color); +} + /** * gdk_colormap_get_system: * diff --git a/gdk/gdkcolor.h b/gdk/gdkcolor.h index 2ab41261b5..46f4a645b8 100644 --- a/gdk/gdkcolor.h +++ b/gdk/gdkcolor.h @@ -127,13 +127,14 @@ void gdk_colormap_query_color (GdkColormap *colormap, GdkVisual *gdk_colormap_get_visual (GdkColormap *colormap); -GdkColor *gdk_color_copy (const GdkColor *color); -void gdk_color_free (GdkColor *color); -gboolean gdk_color_parse (const gchar *spec, - GdkColor *color); -guint gdk_color_hash (const GdkColor *colora); -gboolean gdk_color_equal (const GdkColor *colora, - const GdkColor *colorb); +GdkColor *gdk_color_copy (const GdkColor *color); +void gdk_color_free (GdkColor *color); +gboolean gdk_color_parse (const gchar *spec, + GdkColor *color); +guint gdk_color_hash (const GdkColor *colora); +gboolean gdk_color_equal (const GdkColor *colora, + const GdkColor *colorb); +gchar * gdk_color_to_string (const GdkColor *color); GType gdk_color_get_type (void) G_GNUC_CONST; -- 2.30.2